﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using C1.Web.Wijmo.Controls.C1Editor;

namespace weba
{
    public partial class bianjinews : System.Web.UI.Page
    {
     public   string tid;
        sjklqDataContext sj = new sjklqDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
          tid = Request.QueryString["id"];
            if (!IsPostBack)
            {
                xinwen xw = sj.xinwen.Where(h=>h.Id.ToString() == tid).FirstOrDefault() ;
                Label1.Text = tid;
                C1InputText1.Text = xw.tit;
                C1Editor1.Text = xw.discp;
            }
        }

        protected void C1Editor1_TextSaved(object sender, EventArgs e)
        {
         xinwen sx=   sj.xinwen.Single(h => h.Id.ToString() ==tid);
         sx.tit = C1InputText1.Text;
         sx.discp = C1Editor1.Text;
         sx.shijian = DateTime.Now;
         sj.SubmitChanges();
         Label2.Text = "更新成功";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            xinwen sx = sj.xinwen.Single(h => h.Id.ToString() == tid);
            sx.tit = C1InputText1.Text;
            sx.discp = C1Editor1.Text;
            sx.shijian = DateTime.Now;
            sj.SubmitChanges();
            Label2.Text = "更新成功";
        }
    }
}